#define _CRT_SECURE_NO_WARNINGS 1


#include<vector>
#include<iostream>

using namespace std;

int numRookCaptures(vector<vector<char>>& board)
{
    int begin = 0;
    int count = 0;
    for (int i = 0; i < 8; i++)
    {
        for (int j = 0; j < 8; j++)
        {
            if (board[i][j] == 'R')
            {
                begin = i + 1;
                while (board[begin][j] == '.' && begin < 8)
                {
                    begin++;
                }
                if (board[begin][j] == 'p')
                {
                    count++;
                }

                begin = i - 1;
                while (board[begin][j] == '.' && begin < 8)
                {
                    begin--;
                }
                if (board[begin][j] == 'p')
                {
                    count++;
                }

                begin = j - 1;
                while (board[i][begin] == '.' && begin < 8)
                {
                    begin--;
                }
                if (board[i][begin] == 'p')
                {
                    count++;
                }

                begin = j + 1;
                while (board[i][begin] == '.' && begin < 8)
                {
                    begin++;
                }
                if (board[i][begin] == 'p')
                {
                    count++;
                }
            }
        }
    }
    return count;
}


//int main()
//{
//
//
//	return 0;
//}